package main

import (
	"encoding/json"
	"fmt"
)

func unmarshalMap() {
	str := `{"t_1":{"age":35,"name":"laoli","stu":{"age":12,"name":"xiaoming"}}}`
	var m map[string]interface{}
	// 反序列化不需要make
	err := json.Unmarshal([]byte(str), &m) // 将string转为byte，引用传递,即交给哪个类型
	if err != nil{
		fmt.Println("err", err)
	}
	fmt.Println(m)

	//fileT,err := os.OpenFile("a.txt", os.O_WRONLY | os.O_CREATE | os.O_APPEND, 0666)
	//writer := bufio.NewWriter(fileT)
	//r := json.NewEncoder(writer)
	//fmt.Println(r)

}

func main() {
	unmarshalMap()
}
